package com.nursebetty.droid.client.activity;

import com.nursebetty.droid.client.model.User;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

public class SignIn extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.signin);
        
        Button signinButton = (Button)findViewById(R.id.loginBtn);
        signinButton.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				User user = new User();
				EditText userName = (EditText)findViewById(R.id.emailField);
				EditText password = (EditText)findViewById(R.id.passwordField);
				
				user.setUserName(userName.getText().toString());
				user.setName("ashkan");
				
				//if the login was successful then 
				//set the user object and go to main page
				Intent i = new Intent(SignIn.this, Main.class);
				Bundle b = new Bundle();
				b.putSerializable("user", user);
				i.putExtras(b);
				
				startActivity(i);
				
			}
		});
    }
}